package com.mall.shopping.converter;


import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.CartProductDto;
import com.mall.shopping.dto.CartProductDto;
import com.mall.shopping.dto.UpdateCartBO;
import com.mall.shopping.dto.UpdateCartNumRequest;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * Created by cskaoyan on 2019/7/23.
 */

@Mapper(componentModel = "spring")
public interface CartItemConverter {
    UpdateCartNumRequest carUpdateBO2Request(UpdateCartBO bo);

    @Mappings({
                @Mapping(source = "id", target = "productId"),
                @Mapping(source = "price", target = "salePrice"),
                @Mapping(source = "title", target = "productName"),
                @Mapping(source = "image", target = "productImg"),
            })
    CartProductDto item2CartProductDto(Item item);
}
